package friot.feign.clients;

import friot.model.iot.entity.IotThings;
import friot.model.iot.vo.IotDeviceVo;
import friot.utils.tools.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author He Kuntao
 * @desc Device Feign Client
 * @date 2024/3/14 22:21
 */
@FeignClient(name = "friot-service-cloud")
public interface IDeviceClient {

    /**
     * 根据用户ID查询设备
     *
     * @param id 用户ID
     * @return 设备集合
     */
    @GetMapping("/api/iot/device/{id}")
    Result listDeviceByUserId(@PathVariable String id);

    /**
     * 根据设备ID查询设备日志
     *
     * @param deviceId   设备ID
     * @param identified 设备标识
     * @param num        最近5条消息
     * @return 设备Things集合
     */
    @GetMapping("/api/iot/device/things")
    Result listDeviceThings(@RequestParam String deviceId,
                                            @RequestParam String identified,
                                            @RequestParam(defaultValue = "5") Integer num);

}
